package vinux.web.common.es;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import vinux.service.service.tchange.service.TChangeService;
import vinux.service.service.userbaseinfo.service.UserBaseInfoService;

public class TestUtil implements ApplicationListener<ContextRefreshedEvent>{

	@Autowired
	TChangeService tchangeService;
	
	@Autowired
	UserBaseInfoService userService;
	
	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		if(event.getApplicationContext().getParent()==null && event.getApplicationContext().getDisplayName().equals("Root WebApplicationContext")){
			SyncWorker worker = new SyncWorker(userService,tchangeService);
			new Thread(worker).start();
		}
		
	}

	
}
